package com.yonyou.brigade.ybz.controller;

import com.alibaba.fastjson.JSONObject;
import com.yonyou.brigade.ybz.service.ICnvOutentitydefService;
import com.yonyou.brigade.ybz.service.MakeRegisterString;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/ybz/cnv")
public class CnvRegisterController {

    @Autowired
    @Qualifier("cnvOutentitydefServiceImpl")
    private ICnvOutentitydefService cnvOutentitydefService;

    @RequestMapping(value = "/getRegSQL", method = RequestMethod.POST)
    public @ResponseBody
    String getRegSQL(@RequestBody Map params) {
        String typeCode=params.get("code").toString();
        String typeName=params.get("name").toString();
        net.sf.json.JSONObject json= net.sf.json.JSONObject.fromObject(params.get("json"));
       MakeRegisterString makeRegisterString=  MakeRegisterString.getInstance(typeCode,typeName,cnvOutentitydefService);
      String result=  makeRegisterString.getRegisterSQL(json.toString());
      return result;


    }
}
